﻿using System.Windows.Forms;

namespace YanZhiwei.DotNet2.Utilities.WinForm
{
    /// <summary>
    /// TabControl 帮助类
    /// </summary>
    public static class TabControlHelper
    {
        #region  显示TabPage
        /// <summary>
        /// 显示TabPage
        /// </summary>
        /// <param name="tabControl">TabControl对象</param>
        /// <param name="tabpage">需要显示的TabPage</param>
        public static void SetTabPagesVisible(this TabControl tabControl, TabPage tabpage)
        {
            tabControl.TabPages.Clear();
            tabControl.TabPages.Add(tabpage);
        }
        /// <summary>
        /// 显示TabPage
        /// </summary>
        /// <param name="tabControl">TabControl对象</param>
        /// <param name="tabpage">需要显示的TabPage集合</param>
        public static void SetTabPagesVisible(this TabControl tabControl, params TabPage[] tabpage)
        {
            tabControl.TabPages.Clear();
            tabControl.TabPages.AddRange(tabpage);
        }
        #endregion 
    }
}
